package com.feihao.zhou.UDP.demo01;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolTest1 {
    public static void main(String[] args) {
        //创建一个默认的线程池对象，池子默认为空，
        // 最多可容纳int的最大值2^31-1个数线程。

        ExecutorService executorService = Executors.newCachedThreadPool();
        //ExecutorService  可以控制线程；
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"在执行");
        });
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"在执行");
        });
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"在执行");
        });

        executorService.shutdown();

    }
}
